<template>
  <body>
    <header>
      <section>
        <label for="title">ToDoList</label>
        <input type="text" v-model="msg" @keydown.13="fn()" />
      </section>
    </header>
    <Do :arr="arr" :get="get" :get2="get2"> </Do>
    <footer></footer>
  </body>
</template>
<script>
import Do from "./toDoz.vue";
export default {
  components: {
    Do,
  },
  data() {
    return {
      msg: "",
      arr: [],
      bool: false,
      str: "",
      n: 0,
      s: 0,
    };
  },
  methods: {
    fn() {
      this.arr.push({
        name: this.msg,
        checked: false,
        check: false,
        c: false,
        d: true,
      });
      this.msg = "";
      this.n++;
      var text=undefined
      console.log(typeof text==undefined);
    },
    sj(item) {
      item.check = true;
      item.name = "";
      this.str = "";
    },
    d(item) {
      item.name = this.str;
      item.check = false;
    },
    del(item) {
      item.c = true;
      this.n--;
    },
    li(item) {
      if (item.checked == false) {
        this.n--;
        this.s++;
      }
    },
    dell(item) {
      item.d = false;
      this.s--;
    },
  },
  computed: {
    get() {
      var n = 0;
      this.arr.forEach((item) => {
        if (item.checked == false) {
          n++;
        }
      });
      return n;
    },
  },
};
</script>
<style lang="css">
* {
  margin: 0;
  padding: 0;
}
body {
  width: 800px;
  height: 500px;
  margin: 0 auto;
}
#sj {
  width: 300px;
  height: 30px;
  border: 1px solid #000;
  position: absolute;
  left: 100px;
  top: 10px;
}
header section {
  width: 800px;
  height: 100px;
  background: #000;
  overflow: hidden;
}
label {
  width: 80px;
  float: left;
  font-size: 25px;
  color: #fff;
  margin-left: 200px;
  margin-top: 20px;
}
input {
  width: 300px;
  height: 20px;
  float: right;
  margin-right: 180px;
  margin-top: 28px;
  border-radius: 3px;
  border: none;
  outline: none;
  padding-left: 5px;
  box-sizing: border-box;
}
.sto {
  width: 100%;
  height: 420px;
  background: #ccc;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}
.sto div:nth-child(1) {
  width: 600px;
  margin: 50px auto;
  height: 100px;
}
.sto div:nth-child(2) {
  width: 600px;
  margin: 50px auto;
  height: 50px;
}
.sto div:nth-child(1) h2 {
  float: left;
  margin-top: 10px;
}
.sto div:nth-child(1) span {
  float: right;
  width: 30px;
  height: 30px;
  border-radius: 20px;
  margin-top: 15px;
  background: #fff;
  text-align: center;
}
.sto div:nth-child(2) h2 {
  float: left;
  margin-top: 10px;
}
.sto div:nth-child(2) span {
  float: right;
  width: 30px;
  height: 30px;
  border-radius: 20px;
  margin-top: 15px;
  background: #fff;
  text-align: center;
}
#donelist {
  width: 600px;
  height: 50px;
  position: absolute;
  top: 98px;
  left: 95px;
}
#list span {
  float: right;
  width: 30px;
  height: 30px;
  border-radius: 20px;
  margin-top: 15px;
  background: #000;
  text-align: center;
}
li {
  width: 600px;
  height: 50px;
  list-style: none;
  background: #fff;
  line-height: 50px;
  position: relative;
}
li input {
  float: left;
  width: 50px;
  height: 50px;
  margin: 0px;
}
li i {
  float: right;
  width: 30px;
  height: 30px;
  background: #000;
  border-radius: 15px;
  margin-top: 10px;
}
li span {
  float: left;
  margin-left: 50px;
  text-align: center;
}
#list {
  position: absolute;
  left: 100px;
  top: 250px;
}
</style>
